
import * as CONST from './const';
import ExtractAssetInfo from './core/01_ExtractAssetInfo';
import Cache from './core/00_Cache';
/**
 * @en 
 * @zh 为扩展的主进程的注册方法
 */
export const methods: { [key: string]: (...any: any) => any } = {
    openSetting() {
        Editor.Panel.open("export_ts.setting");
    },
    exportTs() {
        ExtractAssetInfo.start();
    },
    openReplace() {
        Editor.Panel.open("export_ts.replace");
    }
};

/**
 * @en Hooks triggered after extension loading is complete
 * @zh 扩展加载完成后触发的钩子
 */
export const load = function() {
    Editor.Message.addBroadcastListener('asset-db:asset-change', Cache.onAssetChange);
    Editor.Message.addBroadcastListener('asset-db:asset-delete', Cache.onAssetDelete);
};

/**
 * @en Hooks triggered after extension uninstallation is complete
 * @zh 扩展卸载完成后触发的钩子
 */
export const unload = function() {
    Editor.Message.removeBroadcastListener('asset-db:asset-change', Cache.onAssetChange);
    Editor.Message.removeBroadcastListener('asset-db:asset-delete', Cache.onAssetDelete);
};
